package com.yunji.app.base;


import com.yunji.aggregate.model.dto.analysis.StatisticsCommonParam;
import com.yunji.aggregate.model.dto.container.FillCargoCountParam;
import com.yunji.aggregate.model.dto.container.FillCargoParam;
import com.yunji.aggregate.model.vo.analysis.FillCargoDataVO;
import com.yunji.aggregate.model.vo.analysis.FillCargoLocationVO;
import com.yunji.aggregate.model.vo.analysis.FillCargoMonthVO;
import com.yunji.aggregate.model.vo.analysis.FillCargoTimeDataVO;
import com.yunji.aggregate.model.vo.container.FillCargoContainerVO;
import com.yunji.aggregate.model.vo.container.FillCargoProductVO;
import com.yunji.aggregate.service.AnalysisService;
import com.yunji.common.base.BaseController;
import com.yunji.common.base.response.Response;
import com.yunji.common.base.response.ResponseHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.app.user
 * @Title: GateWayAnalysisController
 * @Description: TODO:
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-06-19 15:15:34      V1.0        HuaAo       数据分析
 */
@Api(tags = "移动端-数据分析")
@RestController
@RequestMapping("/gateway/analysis")
public class GateWayAnalysisController extends BaseController {
    @Resource
    private AnalysisService analysis;

    @GetMapping(value = "/fillCargoContainerList")
    @ApiOperation("分页查询货柜补货列表")
    public Response<List<FillCargoContainerVO>> fillCargoContainerList(FillCargoParam cabinetParam) {
        List<FillCargoContainerVO> list = analysis.fillCargoContainerList(cabinetParam);
        return ResponseHelper.successWithPage(list);
    }

    @GetMapping(value = "/fillCargoProductList")
    @ApiOperation("分页查询商品补货列表")
    public Response<List<FillCargoProductVO>> fillCargoProductList(FillCargoParam cabinetParam) {
        List<FillCargoProductVO> list = analysis.fillCargoProductList(cabinetParam);
        return ResponseHelper.successWithPage(list);
    }

    @GetMapping(value = "/fillCargoProductInfo")
    @ApiOperation("商品补货详情")
    public Response<List<FillCargoContainerVO>> fillCargoProductInfo(@RequestParam("productId") Long productId) {
        List<FillCargoContainerVO> list = analysis.fillCargoProductInfo(productId);
        return ResponseHelper.successWithPage(list);
    }

    @GetMapping(value = "/fillCargoData")
    @ApiOperation("货柜补货数据")
    public Response<FillCargoDataVO> fillCargoData() {
        return ResponseHelper.success(analysis.fillCargoData());
    }

    @GetMapping(value = "fillCargoDataByMonth")
    @ApiOperation("员工每月补货数据")
    public Response<FillCargoMonthVO> fillCargoDataByMonth(FillCargoCountParam param) {
        return ResponseHelper.success(analysis.fillCargoDataByMonth(param));
    }

    @GetMapping(value = "fillCargoCountByDate")
    @ApiOperation("员工按年分月补货次数")
    public Response<List<FillCargoTimeDataVO>> fillCargoCountByDate(FillCargoCountParam param) {
        return ResponseHelper.success(analysis.fillCargoCountByDate(param));
    }

    @GetMapping("fillCargoLocation")
    @ApiOperation("补货点位列表")
    public Response<List<FillCargoLocationVO>> fillCargoLocation(FillCargoParam param){
        return ResponseHelper.successWithPage(analysis.fillCargoLocation(param));
    }

}